import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/index.vue'
import Mine from '../views/mine.vue'
import ShopCar from '../views/shopCar.vue'
import shopList from '@/views/shopList.vue'
import comInfo from '@/views/commodity/info.vue'
import orderForGoods from '@/views/mine/orderForGoods.vue'
Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'index',
    component: Index
  },
  {
    path: '/ShopCar',
    name: 'ShopCar',
    component: ShopCar
  },
  {
    path: '/mine',
    name: 'mine',
    component: Mine
  },
  {
    path: '/shopList',
    name: 'shopList',
    component: shopList
  },
  {
    path: '/comInfo',
    name: 'comInfo',
    component: comInfo
  },
  {
    path: '/orderForGoods',
    name: 'orderForGoods',
    component: orderForGoods
  },
]

const router = new VueRouter({
  routes
})

router.beforeEach((to, from, next) => {
  next()
})

router.afterEach((to, from) => {
  // console.log(to);
  // console.log(from);
})

export default router